{% if (registry.has('theme_options') == constant('true')) %}

     {% set theme_options = registry.get('theme_options') %}
     {% set config = registry.get('config') %}

     {% set language_id = config.get( 'config_language_id' ) %}
     {% set customfooter = theme_options.get( 'customfooter' ) %}

     {% set customfooter_top = theme_options.getModules('customfooter_top') %}
     {% set customfooter_bottom = theme_options.getModules('customfooter_bottom') %}
     {% set customfooter_center = theme_options.getModules('customfooter') %}
     {% set footer_center = theme_options.getModules('footer') %}

     {% if (customfooter[language_id] is defined or customfooter_top|length > 0 or customfooter_bottom|length > 0 or customfooter_center|length > 0) %}
          {% if (customfooter[language_id]['twitter_status'] == '1' or customfooter[language_id]['contact_status'] == '1' or customfooter[language_id]['aboutus_status'] == '1' or customfooter[language_id]['facebook_status'] == '1' or customfooter_top|length > 0 or customfooter_bottom|length > 0 or customfooter_center|length > 0) %}

               {% set grids = 12 %} {% set test = 0 %}
               {% if (customfooter[language_id]['aboutus_status'] == '1') %} {% set test = test + 1 %} {% endif %}
               {% if (customfooter[language_id]['twitter_status'] == '1') %} {% set test = test + 1 %} {% endif %}
               {% if (customfooter[language_id]['facebook_status'] == '1') %} {% set test = test + 1 %} {% endif %}
               {% if (customfooter[language_id]['contact_status'] == '1') %} {% set test = test + 1 %} {% endif %}
               {% if (customfooter[language_id]['customblock_status'] == '1') %} {% set test = test + 1 %} {% endif %}
               {% if (test == 0) %} {% set test = 1 %} {% endif %}
               {% set grids = 12/test %}
               {% if (test == 5) %} {% set grids = 25 %}{% endif %}


     <!-- CUSTOM FOOTER
          ================================================== -->
     <div class="custom-footer {% if (theme_options.get( 'custom_footer_layout' ) == 1) %} {{ 'full-width' }} {% elseif (theme_options.get( 'custom_footer_layout' ) == 4) %} {{ 'fixed3 fixed2' }} {% elseif (theme_options.get( 'custom_footer_layout' ) == 3) %} {{ 'fixed2' }} {% else %} {{ 'fixed' }} {% endif %}">
          <div class="background-custom-footer"></div>
          <div class="background">
               <div class="shadow"></div>
               <div class="pattern">
                    <div class="container">

                         {% if ( customfooter_top|length > 0 ) %}
                              {% for module in customfooter_top %}
                                   {{ module }}
                              {% endfor %}
                         {% endif %}


                         {% if ( customfooter_center|length > 0 ) %}
                              {% for module in customfooter_center %}
                                   {{ module }}
                              {% endfor %}
                         {% else %}
                              <div class="row">
                                   {% if (customfooter[language_id]['aboutus_status'] == '1') %}
                                   <!-- About us -->
                                   <div class="col-sm-{{ grids }}">
                                        {% if (customfooter[language_id]['aboutus_title'] != '') %}
                                        <h4>{{ customfooter[language_id]['aboutus_title'] }}</h4>
                                        {% endif %}
                                        <div class="custom-footer-text">{{ theme_options.html_entity_decode(customfooter[language_id]['aboutus_text']) }}</div>
                                   </div>
                                   {% endif %}

                                   {% if (customfooter[language_id]['contact_status'] == '1') %}
                                   <!-- Contact -->
                                   <div class="col-sm-{{ grids }}">
                                        {% if (customfooter[language_id]['contact_title'] != '') %}
                                        <h4>{{ customfooter[language_id]['contact_title'] }}</h4>
                                        {% endif %}
                                        <ul class="contact-us clearfix">
                                             {% if (customfooter[language_id]['contact_phone'] != '' or customfooter[language_id]['contact_phone2'] != '') %}
                                             <!-- Phone -->
                                             <li>
                                                  <i class="fa fa-mobile-phone"></i>
                                                  <p>
                                                       {% if (customfooter[language_id]['contact_phone'] != '') %}
                                                            {{ customfooter[language_id]['contact_phone'] }}<br>
                                                       {% endif %}
                                                       {% if (customfooter[language_id]['contact_phone2'] != '') %}
                                                            {{ customfooter[language_id]['contact_phone2'] }}
                                                       {% endif %}
                                                  </p>
                                             </li>
                                             {% endif %}
                                             {% if (customfooter[language_id]['contact_email'] != '' or customfooter[language_id]['contact_email2'] != '') %}
                                             <!-- Email -->
                                             <li>
                                                  <i class="fa fa-envelope"></i>
                                                  <p>
                                                       {% if (customfooter[language_id]['contact_email'] != '') %}
                                                            <span>{{ customfooter[language_id]['contact_email'] }}</span><br>
                                                       {% endif %}
                                                       {% if (customfooter[language_id]['contact_email2'] != '') %}
                                                            <span>{{ customfooter[language_id]['contact_email2'] }}</span>
                                                       {% endif %}
                                                  </p>
                                             </li>
                                             {% endif %}
                                             {% if (customfooter[language_id]['contact_skype'] != '' or customfooter[language_id]['contact_skype2'] != '') %}
                                             <!-- Phone -->
                                             <li>
                                                  <i class="fa fa-skype"></i>
                                                  <p>
                                                       {% if (customfooter[language_id]['contact_skype'] != '') %}
                                                            {{ customfooter[language_id]['contact_skype'] }}<br>
                                                       {% endif %}
                                                       {% if (customfooter[language_id]['contact_skype2'] != '') %}
                                                            {{ customfooter[language_id]['contact_skype2'] }}
                                                       {% endif %}
                                                  </p>
                                             </li>
                                             {% endif %}
                                        </ul>
                                   </div>
                                   {% endif %}

                                   {% if (customfooter[language_id]['twitter_status'] == '1') %}
                                   <!-- Twitter -->
                                   <div class="col-sm-{{ grids }}">
                                        {% if (customfooter[language_id]['twitter_title'] != '') %}
                                        <h4>{{ customfooter[language_id]['twitter_title'] }}</h4>
                                        {% endif %}

                                        <div class="clear">
                                             <a class="twitter-timeline" href="https://twitter.com/{{ customfooter[language_id]['twitter_widget_id'] }}" data-tweet-limit="2">Tweets by {{ customfooter[language_id]['twitter_widget_id'] }}</a> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
                                        </div>
                                   </div>
                                   {% endif %}

                                   {% if (customfooter[language_id]['facebook_status'] == '1') %}
                                   <!-- Facebook -->
                                   <div class="col-sm-{{ grids }}">
                                        {% if (customfooter[language_id]['facebook_title'] != '') %}
                                        <h4>{{ customfooter[language_id]['facebook_title'] }}</h4>
                                        {% endif %}

                                        <div id="fb-root"></div>
                                        <script>(function(d, s, id) {
                                          var js, fjs = d.getElementsByTagName(s)[0];
                                          if (d.getElementById(id)) return;
                                          js = d.createElement(s); js.id = id;
                                          js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
                                          fjs.parentNode.insertBefore(js, fjs);
                                        }(document, 'script', 'facebook-jssdk'));</script>

                                        <div id="facebook">
                                             <div class="fb-like-box fb_iframe_widget" profile_id="{{ customfooter[language_id]['facebook_id'] }}" data-show-border="false"
                                              data-width="260" data-height="{% if (customfooter[language_id]['facebook_height'] > 0) %} {{ customfooter[language_id]['facebook_height'] }} {% else %} {{ '210' }} {% endif %}" {% if (customfooter[language_id]['show_faces'] != '1') %}data-connections="{% if (customfooter[language_id]['facebook_faces'] > 0) %} {{ customfooter[language_id]['facebook_faces'] }} {% else %} {{ '8' }} {% endif %}"{% endif %} data-colorscheme="{% if (customfooter[language_id]['color_scheme'] != '1') %} {{ 'light' }} {% else %} {{ 'dark' }} {% endif %}" data-stream="false" data-header="false" data-show-faces="{% if (customfooter[language_id]['show_faces'] == '1') %} {{ 'false' }} {% else %} {{ 'true' }} {% endif %}" fb-xfbml-state="rendered"></div>
                                        </div>
                                   </div>
                                   {% endif %}

                                   {% if (customfooter[language_id]['customblock_status'] == '1') %}
                                   <!-- Custom block -->
                                   <div class="col-sm-{{ grids }}">
                                        {% if (customfooter[language_id]['customblock_title'] != '') %}
                                        <h4>{{ customfooter[language_id]['customblock_title'] }}</h4>
                                        {% endif %}
                                        <div class="custom-footer-text">{{ theme_options.html_entity_decode(customfooter[language_id]['customblock_text']) }}</div>
                                   </div>
                                   {% endif %}
                              </div>
                         {% endif %}


                         {% if ( customfooter_bottom|length > 0 ) %}
                              {% for module in customfooter_bottom %}
                                   {{ module }}
                              {% endfor %}
                         {% endif %}
                    </div>
               </div>
          </div>
     </div>
     {% endif %} {% endif %}

     <!-- FOOTER
          ================================================== -->
     <div class="footer {% if (theme_options.get( 'footer_layout' ) == 2) %} {{ 'fixed' }} {% elseif (theme_options.get( 'footer_layout' ) == 4) %} {{ 'fixed3 fixed2' }} {% elseif (theme_options.get( 'footer_layout' ) == 3) %} {{ 'fixed2' }} {% else %} {{ 'full-width' }} {% endif %}">
          <div class="background-footer"></div>
          <div class="background">
               <div class="shadow"></div>
               <div class="pattern">
                    <div class="container">

                         {% if ( footer_center|length > 0 ) %}
                              {% for module in footer_center %}
                                   {{ module }}
                              {% endfor %}
                         {% else %}

                          {% set footer_top = theme_options.getModules('footer_top') %}
                          {% if ( footer_top|length > 0 ) %}
                              {% for module in footer_top %}
                                   {{ module }}
                              {% endfor %}
                          {% endif %}

                              <div class="row footer-main-box">

                              {% set footer_left = theme_options.getModules('footer_left') %}
                              {% set footer_right = theme_options.getModules('footer_right') %}

                              {% set span = 3 %}
                              {% if ( footer_left|length > 0 and footer_right|length > 0 ) %}
                                   {% set span = 2 %}
                              {% elseif ( footer_left|length > 0 or footer_right|length > 0 ) %}
                                   {% set span = 25 %}
                              {% endif %}

                                   {% if ( footer_left|length > 0 ) %}
                                   <div class="col-sm-{{ span }}">
                                   {% for module in footer_left %}
                                        {{ module }}
                                   {% endfor %}
                                   </div>
                                   {% endif %}

                                   {% if ( footer_right|length > 0 ) %}
                                   <div class="col-sm-{{ span }}">
                                   {% for module in footer_right %}
                                        {{ module }}
                                   {% endfor %}
                                   </div>
                                   {% endif %}
                              </div>


                         {% set footer_bottom = theme_options.getModules('footer_bottom') %}
                         {% if ( footer_bottom|length > 0 ) %}
                              {% for module in footer_bottom %}
                                   {{ module }}
                              {% endfor %}
                         {% endif %}

                         {% endif %}
                    </div>
               </div>
          </div>
     </div>

     <script type="text/javascript" src="catalog/view/theme/fastor/js/megamenu.js"></script>
</div>
</div>
{% endif %}
</body>
</html>
